// 反转字符串中的单词

package Leetcode;

import java.util.StringJoiner;

public class Solution151 {
    public String reverseWords(String s) {
        String[] strArray = s.trim().split("\\s+");
        StringJoiner joiner = new StringJoiner(" ");
        for (int i = strArray.length - 1; i >= 0; i--) {
            joiner.add(strArray[i]);
        }
        return joiner.toString();
    }
}
